$(document).ready(function(){
	//添加异常信息
	if(msg!=""&&msg!="null"){
		$("#message > .error").html(msg);
	};
	$("#userName").focus();
	//js表单校验
	$("#formLogin").validate({
		//验证通过提交表单
		submitHandler:function(form) {
			$("#login").button('loading');//提交时屏蔽多次点击
			form.submit();
		},
	    errorPlacement:function(error,element) {//设置提示消息位置
	    	$("#message").html(error);
	    },
	     rules: {
	    	 "user.userName": {
		    	    required: true,
		    	    minlength: 3
		     },
	    	 "user.password": {
		    	    required: true,
		    	    minlength: 1
		     }/*,
		     "captcha": {//验证码
		    	 required: true,
		    	 remote: {//远程验证验证码是否正确  
		    		 url:base+"/validateCaptcha",
		    		 type: "GET",               //数据发送方式
		    		 dataType: "json",           //接受数据格式   
		    		 data: {                     //要传递的数据
		    			 captcha:function() {
		    				 return $("#captcha").val();
		    			 }
		    		 }
		    	 }
		     }*/
	    },
	     messages: {
	    	 "user.userName": {
	    	    required: "请输入用户名",
	    	    minlength: "用户名不能小于{0}个字 符"
	    	 },
	    	 "user.password": {
	    	    required: "请输入密码",
	    	    minlength: "密码不能小于{0}个字 符"
	    	 }/*,
	    	 "captcha": {
	    		required: "请输入验证码",
	    		remote: "验证码不正确"
	    	  }*/
	    }
	 });
});